//
//  ParallaxTestVC.swift
//  elarc01
//
//  Created by elarc on 2016/10/12.
//  Copyright © 2016年 elarc. All rights reserved.
//

import Foundation

class ParallaxTestVC: UIViewController {
    
    let label = UILabel()
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.whiteColor()
        // Do any additional setup after loading the view, typically from a nib.
        treeTest()
        
    }
    
    func treeTest() -> Void {
        
        let items = ["ParallaxVC", "PureCodeViewController", "TableviewHeaderViewController"]
        let segmentedControl = UISegmentedControl(items: items)
        segmentedControl.selectedSegmentIndex = 0
        segmentedControl.layer.cornerRadius = 5.0
        segmentedControl.backgroundColor = UIColor.whiteColor()
        segmentedControl.tintColor = UIColor(white: 0.2, alpha: 1)
        segmentedControl.frame = CGRectMake(50, 100, ScreenWidth-100, 44)
        segmentedControl.addTarget(self, action: #selector(segmentedControlTouch), forControlEvents: .ValueChanged)
        self.view.addSubview(segmentedControl)
        
    }
    
    func segmentedControlTouch(sender: UISegmentedControl) -> Void{
        let parallVc = ParallaxVC()
        let pureCodeViewController = PureCodeViewController()
        let tableviewHeaderViewController = TableviewHeaderViewController()
        switch sender.selectedSegmentIndex {
        case 0:
            self.navigationController?.pushViewController(parallVc, animated: true)
        case 1:
            self.navigationController?.pushViewController(pureCodeViewController, animated: true)
        case 2:
            self.navigationController?.pushViewController(tableviewHeaderViewController, animated: true)
        default:
            break
        }
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
}

